<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>$attrs 透传</title>
</head>
<body>
  <div id="app">
    <my-button test="test" class="btn" @click="onClick" ></my-button>
  </div>
</body>
<template id="btn">
  <div class="a">
    <button class="b">按钮</button>
    <button class="b">按钮</button>
  </div>
</template>
<script src="../lib/vue.global.js"></script>
<script>
  const Btn = {
    inheritAttrs: true,
    template: '#btn',
    mounted () {
      console.log(this.$attrs)
    }
  }
  Vue.createApp({
    components: {
      MyButton: Btn
    }
  }).mount('#app')
</script>
</html>